
all: source  dgb_symbol

mbr:
# bochs时使用
#	只拷贝 440-90
	dd if=./bin/mbr.bin of=./dev/hd.img bs=1 skip=90 seek=90 count=350 conv=notrunc
# 真实USB使用
#	dd if=./bin/mbr.bin of=/dev/sda bs=1 count=422 seek=90 conv=notrunc


boot:
# bochs时使用
	dd if=./bin/boot.bin of=./dev/hd.img bs=512 count=1024 seek=16 conv=notrunc
# 真实USB使用
#	dd if=./bin/boot.bin of=/dev/sda bs=512 count=1024 seek=16 conv=notrunc

system:
# bochs时使用
	sudo mount -o loop ./dev/hd.img /data/usershare/fat
	sudo cp ./bin/Enjoy.bin /data/usershare/fat
	sudo sync
	sudo umount /data/usershare/fat
# 真实USB使用
#	cp ./bin/Enjoy.bin /media/dragon/HWCH


dgb_symbol:
	objcopy --only-keep-debug ./bin/kernel.elf ./bin/kernel.sym
	objcopy --only-keep-debug ./bin/mbr.elf ./bin/mbr.sym
	objcopy --only-keep-debug ./bin/boot.elf ./bin/boot.sym
source:
	make -C src || exit $$?

.PHONY: install clean

install: mbr boot system
clean:
	rm -f ./bin/kernel.sym ./bin/mbr.sym ./bin/boot.sym
	make -C src clean || exit $$?
